home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
9943
/
9943.xpi
/
content
/
options.js
next >
Wrap
Text File
|
2009-06-05
|
6KB
|
204 lines
var searchcloudlet_options={
doOK:function()
{
//tagcloudjs_PrefManager
var toCheck=['websearch','news','blogsearch','scholar','products','yahoo.web','yahoo.news','twitter.user.my','twitter.user.other','twitter.search'];
var pref='';
for (var i=0;i<toCheck.length;i++)
{
var chk=document.getElementById(toCheck[i]);
if (!chk.checked)
{
pref+=toCheck[i]+' ';
if ('twitter.search'==toCheck[i])
{
pref+='twitter.search.user ';
}
}
}
this.prefMan.setValue('disabledSiteTypes',pref);
var scale=document.getElementById('font-size');
this.prefMan.setValue('fontSize',scale.value);
var maxTags=document.getElementById('max-tags');
this.prefMan.setValue('maxTags',maxTags.value);
var doubleLinks=document.getElementById('doublelinks');
this.prefMan.setValue('useDoubleLinks',doubleLinks.checked);
var doubleLinksColor=document.getElementById('doublelinkscolor');
this.prefMan.setValue('changeDLColor',doubleLinksColor.checked);
var useSCSC=document.getElementById('useSCSC');
this.prefMan.setValue('useSCSC',useSCSC.checked);
//alert(this.prefMan.getValue('disabledSiteTypes'));
},
doCancel:function()
{
//alert('Cancel');
},
init:function()
{
this.prefMan=new tagcloudjs_PrefManager();
var pref=this.prefMan.getValue('disabledSiteTypes','');
var elems=pref.split(' ');
for(var i=0;i<elems.length;i++)
{
if (elems[i] && elems[i].length>0)
{
document.getElementById(elems[i]).checked=false;
}
}
var scale=document.getElementById('font-size');
scale.value=this.prefMan.getValue('fontSize',100);
this.updateFonts(scale.value);
var maxTags=document.getElementById('max-tags');
maxTags.value=this.prefMan.getValue('maxTags',50);
var doubleLinks=document.getElementById('doublelinks');
doubleLinks.checked=this.prefMan.getValue('useDoubleLinks',true);
var doubleLinksColor=document.getElementById('doublelinkscolor');
doubleLinksColor.checked=this.prefMan.getValue('changeDLColor',true);
doubleLinksColor.disabled=!doubleLinks.checked;
var useSCSC=document.getElementById('useSCSC');
useSCSC.checked=this.prefMan.getValue('useSCSC',false);
},
doDefault:function()
{
var scale=document.getElementById('font-size');
scale.value=100;
this.updateFonts(scale.value);
var maxTags=document.getElementById('max-tags');
maxTags.value=50;
},
fontSizeChanged:function()
{
var scale=document.getElementById('font-size');
var val=scale.value;
this.updateFonts(val);
},
updateFonts:function(val)
{
var label=document.getElementById('percents');
label.value=val+'%';
var small=document.getElementById('small-tag');
small.setAttribute("style","font-size:"+Math.round(12*val/100)+"px;");
var medium=document.getElementById('medium-tag');
medium.setAttribute("style","font-size:"+Math.round(27*val/100)+"px;");
var large=document.getElementById('large-tag');
large.setAttribute("style","font-size:"+Math.round(42*val/100)+"px;");
},
doubleLinksChecked:function()
{
var doubleLinks=document.getElementById('doublelinks');
var doubleLinksColor=document.getElementById('doublelinkscolor');
if (doubleLinks.checked)
{
doubleLinksColor.disabled=false;
}
else
{
doubleLinksColor.disabled=true;
}
},
dlMouseOver:function(e)
{
var obj=(e.srcElement)?e.srcElement:(e.target)?e.target:null;
if (!obj.id) return true;
var parts=obj.id.split('-');
if (parts[0].indexOf('dl')!=0) return true;
var myId=parts[0]+'-'+parts[1];
var otherId=parts[0]+'-'+(1-parts[1]);
var changeColor=document.getElementById('doublelinkscolor').checked;
var me=document.getElementById(myId);
var other=document.getElementById(otherId);
if (0==parts[1])
{
var style="text-decoration: underline;";
}
else
{
var style="text-decoration: line-through;";
if (changeColor)
{
style+="color:red;";
}
}
me.setAttribute('style',style);
other.setAttribute('style',style);
/*var myText=document.getElementById('dltext-'+parts[1]);
var otherText=document.getElementById('dltext-'+(1-parts[1]));
myText.setAttribute('style','font-weight:bold;');
otherText.setAttribute('style','');*/
},
dlMouseOut:function(e)
{
var obj=(e.srcElement)?e.srcElement:(e.target)?e.target:null;
if (!obj.id) return;
var parts=obj.id.split('-');
if (parts[0].indexOf('dl')!=0) return true;
var myId=parts[0]+'-'+parts[1];
var otherId=parts[0]+'-'+(1-parts[1]);
var me=document.getElementById(myId);
var other=document.getElementById(otherId);
me.setAttribute('style','');
other.setAttribute('style','');
/*var myText=document.getElementById('dltext-'+parts[1]);
var otherText=document.getElementById('dltext-'+(1-parts[1]));
myText.setAttribute('style','');
otherText.setAttribute('style','');*/
},
dlMouseClick:function(e)
{
var obj=(e.srcElement)?e.srcElement:(e.target)?e.target:null;
if (!obj.id) return;
var parts=obj.id.split('-');
var myText=document.getElementById('dltext-'+parts[1]);
var otherText=document.getElementById('dltext-'+(1-parts[1]));
myText.setAttribute('style','font-weight:bold;');
otherText.setAttribute('style','');
return false;
}
};